<template>
  <el-col :span="8">
    <el-card shadow="hover">
      <div class="user">
        <img :src="userImg" alt="">
        <div class="userinfo">
          <p class="name">Nick</p>
          <p class="access">超级管理员</p>
        </div>
      </div>
      <div class="login-info">
        <p>上次登陆时间:<span>2002-09-26</span></p>
        <p>上次登陆定点:<span>湖南株洲</span></p>
      </div>
    </el-card>
    <el-card shadow="hover" style="height: 522px; margin-top: 20px;">
      <el-table v-if="tableData" :data="tableData">
        <el-table-column show-overflow-tooltip v-for="(val,key) in tableLabel" :key="key" :prop="key" :label="val">
          <!-- 这里v-for遍历的是tableLabel对象而不是数组  所以 key代表的是对象的属性名  而val代表属性值 -->
        </el-table-column>
      </el-table>
    </el-card>
  </el-col>
</template>
<script>
  export default {
    props: ['tableData'],
    data() {
      return {
        userImg: require('@/assets/images/user.png'),
        tableLabel: {
          name: '课程',
          todayBuy: '今日购买',
          monthBuy: '本月购买',
          totalBuy: '总购买'
        },
      }
    },

  }
</script>
<style lang="scss" scoped>
  .user {
    display: flex;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #ccc;
    margin-bottom: 20px;
    /* &info{}    &在scss表示继承父级的类名的意思   &info里面相当于.userinfo     所以我觉得原生更好*/
  }

  .user img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin-right: 40px;
  }

  .userinfo .name {
    font-size: 32px;
    margin-bottom: 10px;
  }

  .userinfo .access {
    color: #999;
  }

  .login-info {
    line-height: 28px;
    font-size: 14px;
    color: #999;
  }

  .login-info span {
    color: #666;
    margin-left: 60px;
  }
</style>